<?php

namespace services\log;

use common\components\Service;
use common\models\log\LogMessage;
use Yii;

class LogMessageService extends Service
{
    /**
     * 新增日志
     * @param int $type
     * @param array $sendData
     * @param array $sendResult
     * @return void
     * @throws \Exception
     */
    public static function create(int $type, array $sendData, array $sendResult): void
    {
        $logMessage = new LogMessage();
        $logMessage->type = $type;
        $logMessage->send_title = '';
        $logMessage->send_data = $sendData;
        $logMessage->send_result = $sendResult;
        $logMessage->saveAndCheckResult();
    }
}